{include file='public/_header' /}

<!-- Main Container -->
<div class="main-container container-fluid">
    <!-- Page Container -->
    <div class="page-container">

        <!-- Page Sidebar -->
        {include file='public/_left' /}
        <!-- /Page Sidebar -->
        <!-- Page Content -->
        <div class="page-content">
            <!-- Page Breadcrumb -->
            <div class="page-breadcrumbs">
                <ul class="breadcrumb">
                    <li class="active">
                        <i class="fa fa-home"></i>&nbsp;会员管理
                    </li>
                    <li>会员列表</li>
                </ul>
            </div>
            <!-- /Page Breadcrumb -->
            <!-- Page Body -->
            <div class="page-body">
                <a href="{:url('admin/member/memberadd')}" class="btn btn-sm btn-primary"><i class="fa fa-plus"></i>&nbsp;添加会员</a>
                <div class="row">
                    <div class="col-xs-12">
                        <div class="widget">
                            <div class="widget-header">
                                <span class="widget-caption">会员列表</span>
                                <div class="widget-buttons">
                                    <!-- 分页 -->
                                    {$members|raw|replace_str}
                                </div>
                            </div>
                            <div class="widget-body">
                                <table class="table table-hover table-bordered">
                                    <thead>
                                        <tr>
                                            <th>ID</th>
                                            <th>用户名</th>
                                            <th>昵称</th>
                                            <th>邮箱</th>
                                            <th>创建时间</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>

                                    <tbody>
                                        {volist name="members" id="member"}
                                            <tr>
                                                <td>{$member.id}</td>
                                                <td>{$member.username}</td>
                                                <td>{$member.nickname}</td>
                                                <td>{$member.email}</td>
                                                <td>{$member.create_time}</td>
                                                <td>
                                                    <a href="{:url('admin/member/memberedit')}" class="btn btn-azure btn-xs editmember">编辑</a>
                                                    <a href="#" class="btn btn-danger btn-xs delmember" dataid="{$member.id}">删除</a>
                                                </td>
                                            </tr>
                                        {/volist}
                                    </tbody>

                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- /Page Body -->
        </div>
        <!-- /Page Content -->

    </div>
    <!-- /Page Container -->
    <!-- Main Container -->

</div>

{include file='public/_js' /}

<script>
    $(function () {
        $(".pagination").addClass('pagination-sm');
    });

    // 删除栏目
    $(".delmember").click(function () {
        var id = $(this).attr('dataid');
        layer.confirm('确定删除吗?',{
                icon: 3,
                title: '提示'
            }, function (index) {
                layer.close(index);
                $.ajax({
                    url: "{:url('admin/member/memberdel')}",
                    type: "post",
                    data: {id: id},
                    dataType: 'json',
                    success: function (data) {
                        console.log(data);
                        if (data.code == 1) {
                            layer.msg("删除成功", {
                                icon: 6,
                                time: 500
                            }, function () {
                                location.href = data.url;
                            });
                        } else {
                            layer.open({
                                title: '删除失败',
                                content: data.msg,
                                icon: 5,
                                anim: 6
                            });
                        }
                    }
                });
            });


        return false;
    });

</script>

</body>
<!--  /Body -->
</html>
